package com.fesine.learn.design.principle.lisovsubstitution;

/**
 * @description: 类描述
 * @author: fesine
 * @createTime:2019/2/16
 * @update:修改内容
 * @author: fesine
 * @updateTime:2019/2/16
 */
public class Test {

    public static void resize(Rectangle rectangle){
        while (rectangle.getWidth() <= rectangle.getLength()){
            rectangle.setWidth(rectangle.getWidth()+1);
            System.out.println("width:"+rectangle.getWidth()+"\tlength:"+rectangle.getLength());
        }
        System.out.println("width:"+rectangle.getWidth()+"\tlength:"+rectangle.getLength());
    }

    public static void main(String[] args) {
        //Rectangle rectangle = new Rectangle();
        //rectangle.setWidth(10);
        //rectangle.setLength(20);
        //resize(rectangle);
        //出现死循环，子类不可替换父类
        //Square square = new Square();
        //square.setSideLength(10);
        //resize(square);
    }
}
